<template>
  <div>
    <div style="margin-bottom: 15px;">
      <span>申请单列表</span>
      <el-button>提交</el-button>
      <el-button @click="applyAddHandle">新增</el-button>
      <el-button @click="applyDelHandle">删除</el-button>
      <el-button>暂存</el-button>
      <el-button>作废</el-button>
      <el-button>撤回</el-button>
    </div>
    <div>
      <el-table :data="drugBox.list" ref="singleTable" border>
        <el-table-column type="index" width="50">
          <template slot-scope="scope">
            <el-radio v-model="drugBox.id" :label="scope.row.id" style="position: relative;left: 6px;top:-2px;" @change="checkitem(scope.row)">&nbsp;</el-radio>
          </template>
        </el-table-column>
        <el-table-column width="150" property="drugsName" label="申请单名称"></el-table-column>
        <el-table-column width="100" property="name" label="慢病类别"></el-table-column>
        <el-table-column property="address" label="申请时间"></el-table-column>
        <el-table-column property="address" label="状态"></el-table-column>
        <el-table-column property="address" label="收费状态"></el-table-column>
        <el-table-column property="address" label="执行状态"></el-table-column>
        <el-table-column property="address" label="备注说明"></el-table-column>
        <el-table-column property="address" label="金额"></el-table-column>
      </el-table>
    </div>
    <div style="margin-top: 5px;">
      <el-form label-width="100px">
        <el-form-item label="申请项目">
          <el-table :data="drugBox.list" ref="singleTable" border>
            <el-table-column type="index" width="50">
              <template slot-scope="scope">
                <el-radio v-model="drugBox.id" :label="scope.row.id" style="position: relative;left: 6px;top:-2px;" @change="checkitem(scope.row)">&nbsp;</el-radio>
              </template>
            </el-table-column>
            <el-table-column width="150" property="drugsName" label="项目"></el-table-column>
            <el-table-column property="address" label="金额"></el-table-column>
          </el-table>
        </el-form-item>
        <el-form-item label="临床诊断">
          <el-input></el-input>
        </el-form-item>
        <el-form-item label="备注">
          <el-input></el-input>
        </el-form-item>
        <el-form-item label="临床印象">
          <el-input></el-input>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        visible: false,
        drugListVisible: false,
        recipelType: '',
        recipelName: '',
        value: '',
        type: [{
            value: '1',
            label: '普方'
          },
          {
            value: '2',
            label: '专家'
          }
        ],
        currentIndex: '',
        prescriptionList: [], // 处方列表
        drugList: [], // 处方药品列表
        drugBox: {
          timeStamp: '',
          id: '',
          list: []
        },
        multipleSelection: []
      }
    },
    methods: {
      // 新增
      applyAddHandle() {
        let obj = {
          prescriptionType: '1',
          prescriptionOrderNumber: '',
          prescriptionCost: '',
          prescriptionDiagnose: '',
          drugList: [{
            id: 1,
            drugsName: '',
            dose: '',
            portion: '',
            dosage: '',
            usage: '',
            frequency: '',
            entrust: ''
          }]
        }
        this.prescriptionList.push(obj)
      },
      // 删除
      applyDelHandle() {
        this.prescriptionList.splice(this.currentIndex, 1)
      },
      // 处方选中事件
      prescriptionClickHandle(item, index) {
        this.currentIndex = index
        this.drugList = item.drugList
        this.drugListVisible = true
        if (item.id) {
          // 已存处方
        } else {
          // 新增处方
        }
      },
    }
  }
</script>

<style>
  .drugs-alert {
    width: 800px;
    height: 500px;
    background-color: #fff;
    border: solid 1px #e7e7e7;
    position: fixed;
    top: 150px;
    right: 50px;
    z-index: 10000;
  }

  .recipel-card {
    background-color: #d1efef;
    margin-bottom: 5px;
    padding: 3px 10px;
  }

  .recipel-card.active {
    background-color: #7cdfd1;
  }
</style>
